#!/usr/bin

# 安装二进制

# /usr/local/bin/test_loss: Text file busy
systemctl disable --now test-loss.service
rm -f /usr/local/bin/test_loss

set -e
wget "http://mirror.wh.io.plus/test_loss/test_loss_$(uname -m)" \
    -O /usr/local/bin/test_loss
set +e

chmod +x /usr/local/bin/test_loss

# 安装 service 必须是 连接符
set -e
wget http://mirror.wh.io.plus/test_loss/deploy/systemd/test-loss.service -O \
    /usr/lib/systemd/system/test-loss.service

chmod 444 /usr/lib/systemd/system/test-loss.service

systemctl enable --now test-loss.service
